Refactor pnpm provider argument handling and validation logic#36
Closed
pirate wants to merge 2 commits into
Closed
Refactor pnpm provider argument handling and validation logic#36pirate wants to merge 2 commits into
pirate wants to merge 2 commits into
Conversation
Pull the duplicated install/update bodies into shared _build_mutation_args / _apply_min_version / _install_args_have_option helpers, matching the npm provider's pattern. Also drops the dead '--loglevel=error' entry that was being prepended to install_args inside arg-presence checks but could never match the searched flag.
Fold the _build_mutation_args / _apply_min_version / _install_args_have_option helpers back into the install and update handlers directly. They were only used in two call sites each, and the indirection didn't pay for itself.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR refactors the argument handling and validation logic in the pnpm binary provider's install and update handlers to improve code clarity and maintainability.
Key Changes
postinstall_scriptsandmin_release_agefrom ternary expressions to explicit if-statements for better readability"--loglevel=error"from the tuple being checked when validating for--ignore-scriptsand--config.minimumReleaseAgeflags, as these checks should only inspect user-providedinstall_argsmin_release_age is not Nonechecks since the value is guaranteed to be set before usedefault_update_handler, extracted the verb selection ("add"vs"update") into a named variable for clarityImplementation Details
The refactoring maintains the same functional behavior while making the code more maintainable:
default_install_handleranddefault_update_handlerreceive consistent refactoring treatmenthttps://claude.ai/code/session_013Vip4GWbvDAjVCx1thr4bs
Summary by cubic
Refactors
pnpmprovider install/update handlers to simplify argument handling and make validation clearer, with no behavior changes. Cleans up defaults, tightens arg checks, and improves readability.postinstall_scriptsandmin_release_age.install_argsfor--ignore-scriptsand--config.minimumReleaseAge; removed dead--loglevel=errorfrom checks.verb.Written for commit a4a7e9c. Summary will update on new commits.